var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var LogManager = require("AA_LogManager");
var ResKeeper = require("AA_ResKeeper");
var CommonUtils = require("AA_CommonUtils");
var UI_Player_UIBindings = require("AA_UI_Player_UIBindings");
var PlayerDataManager = require("AA_PlayerDataManager");
var Excel = require("AA_Excel");
var ExcelUtil = require("AA_ExcelUtil");
var GameBagData = require("AA_GameBagData");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var NodePoolMag = require("AA_NodePoolMag");
var UI_Bullet = require("AA_UI_Bullet");
var UI_BulletBang = require("AA_UI_BulletBang");
var UI_BulletBomb = require("AA_UI_BulletBomb");
var UI_BulletDaBang = require("AA_UI_BulletDaBang");
var BuffMag = require("AA_BuffMag");
var UI_MosterLogic = require("AA_UI_MosterLogic");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_Player = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    t.playerId = 1;
    t.playimg = null;
    t.eff1 = null;
    t.eff2 = null;
    t.bangbangNode = null;
    t.sgattack = 0;
    t.sgattackspeed = 0;
    t.sgbaojilv = 0;
    t.sgbaojia = 0;
    t.sgattacktype = 1;
    t.sgattacktagtype = -1;
    t.sgtianfuid = -1;
    t.kuangrePlayer = null;
    t.buffid = -1;
    t.xiaolajiao = null;
    t.mosterNodes = null;
    t.playerInfo = null;
    t.kuangReParNode = null;
    t.leveliconspr = null;
    t.dabangNode = null;
    t.preName = ["UI_JinJiedujiaoEff", "UI_JinJieHuangGuaEff", "UI_JinJieLiuLianEff", "UI_JinJieShiLiuEff", "UI_JinJieSuanLaJiaoEff", "UI_JinJieSuanTianShanEff", "UI_JinJieGanZheEff"];
    t.aniName = ["UI_JinJiedujiaoAni", "UI_JinJieHuangGuaAni", "UI_JinJieLiuLianAni", "UI_JinJieShiLiuAni", "UI_JinJieSuanLaJiaoAni", "UI_JinJieSuanTianShanAni", "UI_JinJieGanZheAni"];
    t.jinjieEffNode = null;
    t.jinjieAniNode = null;
    t.nowattackindex = 0;
    t.kuangReEffNode = null;
    t.attacktime = 0;
    t.kuangretime = 0;
    t.offkuangretime = 0;
    t.kuangreisOver = false;
    t.playerpuase = false;
    t.issend = false;
    t.ismove = false;
    t.isfashe = false;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    var e = this;
    this.xiaolajiao = this.node.getChildByName("xialajiao");
    this.xiaolajiao.active = false;
    this.scheduleOnce(function () {
      e.resetLoca();
    }, .1);
  };
  _creator.prototype.onClickPlayer = function () { };
  _creator.prototype.onDisable = function () {
    this.resetEff();
  };
  _creator.prototype.resetEff = function () {
    this.cleanKuangReEff();
    this.cleanJinJieEff();
    this.cleanDaBang();
    this.kuangrePlayer = null;
    BuffMag.BuffMgr.clearPlayerSendCount(this);
    this.attacktime = 0;
  };
  _creator.prototype.initPlayerInfo = function (e, t) {
    return __awaiter(this, undefined, undefined, function () {
      var o;
      var n;
      var i = this;
      return __generator(this, function () {
        this.kuangReParNode = this.node.getChildByName("kuangreNode");
        this.mosterNodes = e;
        if (t) {
          this.playerInfo = t;
        } else {
          this.playerInfo = new GameBagData.GameBagData.EquipData();
          this.playerInfo.equipLevel = 1;
        }
        this.eff1 && this.eff2 && this.scheduleOnce(function () {
          if (4 == i.playerInfo.equipLevel) {
            i.addJinJieEff();
          } else {
            i.cleanJinJieEff();
          }
        });
        o = 1e3 + this.playerId;
        n = Excel.Excel.shuiguo(o);
        this.sgattack = n.attack;
        this.sgattackspeed = n.attackspeed;
        this.sgbaojilv = n.baojilv;
        this.sgbaojia = n.baojivalue;
        this.sgattacktype = n.attacktype;
        this.sgattacktagtype = n.attackstate;
        this.waibuleveladd();
        this.hechengAdd();
        this.sgtianfuid = n.talent;
        this.initUi();
        15 == this.playerId && 4 == this.playerInfo.equipLevel && this.createDaBang();
        return [2];
      });
    });
  };
  _creator.prototype.createDaBang = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      var t;
      return __generator(this, function (o) {
        switch (o.label) {
          case 0:
            if (this.dabangNode) {
              return [3, 3];
            } else {
              this.dabangNode = NodePoolMag.NodePoolMag.instance.getNode("bullet5");
              if (this.dabangNode) {
                return [3, 2];
              } else {
                return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "prefabs/bullet/bullet5", cc.Prefab)];
              }
            }
          case 1:
            e = o.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount("bullet5", 1, e);
            this.dabangNode = NodePoolMag.NodePoolMag.instance.getNode("bullet5");
            o.label = 2;
          case 2:
            t = this.node.convertToWorldSpaceAR(cc.v2());
            t = GameGlobalVariable.GameGlobalVariable.playereffNode.convertToNodeSpaceAR(t);
            this.dabangNode.x = t.x;
            this.dabangNode.y = t.y;
            this.dabangNode.getComponent(UI_BulletDaBang.default).initDaBang(this);
            GameGlobalVariable.GameGlobalVariable.playereffNode.addChild(this.dabangNode);
            o.label = 3;
          case 3:
            return [2];
        }
      });
    });
  };
  _creator.prototype.cleanDaBang = function () {
    if (this.dabangNode) {
      NodePoolMag.NodePoolMag.instance.recycleNode("bullet5", this.dabangNode);
      this.dabangNode = null;
    }
  };
  _creator.prototype.getEffName = function () {
    var e = "";
    switch (this.playerId) {
      case 5:
        e = this.preName[3];
        break;
      case 7:
        e = this.preName[2];
        break;
      case 9:
        e = this.preName[0];
        break;
      case 10:
        e = this.preName[1];
        break;
      case 11:
        e = this.preName[4];
        break;
      case 14:
        e = this.preName[5];
        break;
      case 15:
        e = this.preName[6];
    }
    return e;
  };
  _creator.prototype.getAniName = function () {
    var e = "";
    switch (this.playerId) {
      case 5:
        e = this.aniName[3];
        break;
      case 7:
        e = this.aniName[2];
        break;
      case 9:
        e = this.aniName[0];
        break;
      case 10:
        e = this.aniName[1];
        break;
      case 11:
        e = this.aniName[4];
        break;
      case 14:
        e = this.aniName[5];
        break;
      case 15:
        e = this.aniName[6];
    }
    return e;
  };
  _creator.prototype.resetLoca = function () { };
  _creator.prototype.addJinJieEff = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      var t;
      return __generator(this, function (o) {
        switch (o.label) {
          case 0:
            if ("" == this.getEffName()) {
              return [3, 5];
            } else {
              this.jinjieEffNode = NodePoolMag.NodePoolMag.instance.getNode(this.playerId + "jinjieeff");
              if (this.jinjieEffNode) {
                return [3, 2];
              } else {
                e = "prefabs/effpre/jinjieeff/" + this.getEffName();
                return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + e, cc.Prefab)];
              }
            }
          case 1:
            t = o.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount(this.playerId + "jinjieeff", 1, t);
            this.jinjieEffNode = NodePoolMag.NodePoolMag.instance.getNode(this.playerId + "jinjieeff");
            o.label = 2;
          case 2:
            this.jinjieEffNode.x = 0;
            this.jinjieEffNode.y = 0;
            this.eff1.addChild(this.jinjieEffNode);
            this.jinjieAniNode = NodePoolMag.NodePoolMag.instance.getNode(this.playerId + "jinjieani");
            if (this.jinjieAniNode) {
              return [3, 4];
            } else {
              e = "prefabs/effpre/jinjieeff/" + this.getAniName();
              return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + e, cc.Prefab)];
            }
          case 3:
            t = o.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount(this.playerId + "jinjieani", 1, t);
            this.jinjieAniNode = NodePoolMag.NodePoolMag.instance.getNode(this.playerId + "jinjieani");
            o.label = 4;
          case 4:
            this.jinjieAniNode.x = 0;
            this.jinjieAniNode.y = 0;
            this.eff2.addChild(this.jinjieAniNode);
            o.label = 5;
          case 5:
            return [2];
        }
      });
    });
  };
  _creator.prototype.cleanJinJieEff = function () {
    if (this.jinjieEffNode) {
      NodePoolMag.NodePoolMag.instance.recycleNode(this.playerId + "jinjieeff", this.jinjieEffNode);
      this.jinjieEffNode = null;
    }
    if (this.jinjieAniNode) {
      NodePoolMag.NodePoolMag.instance.recycleNode(this.playerId + "jinjieani", this.jinjieAniNode);
      this.jinjieAniNode = null;
    }
  };
  _creator.prototype.waibuleveladd = function () {
    if (this.playerInfo) {
      var e = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguolevel_all, "shuiguoId", this.playerId + 1e3);
      var t = PlayerDataManager.PlayerDataMgr.GetEquipDataById(this.playerId + 1e3).level;
      var o = 0;
      var n = 0;
      for (var i = 0; i < e.length; i++) {
        if (i + 1 <= t && i > 0) {
          o += e[i - 1].addattack;
          n += e[i - 1].addAtkSpeed;
        }
      }
      this.sgattack = this.sgattack + o;
      this.sgattackspeed = this.sgattackspeed - n;
    }
  };
  _creator.prototype.hechengAdd = function () {
    if (this.playerInfo) {
      var e = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", this.playerId + 1e3)[this.playerInfo.equipLevel];
      if (e) {
        this.sgattack = this.sgattack + this.sgattack * e.addattack / 100;
        this.sgattackspeed = this.sgattackspeed / (1 + e.addattackspeed / 100);
      }
    }
  };
  _creator.prototype.getNowHechengLevel = function () {
    if (this.playerInfo) {
      var e = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", this.playerId + 1e3);
      if (e) {
        return e[this.playerInfo.equipLevel];
      }
    }
  };
  _creator.prototype.initUi = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      var t;
      var o;
      return __generator(this, function (n) {
        switch (n.label) {
          case 0:
            if (this.playerInfo) {
              return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/player" + this.playerId + "_" + (this.playerInfo.equipLevel + 1), cc.SpriteFrame)];
            } else {
              return [2];
            }
          case 1:
            e = n.sent();
            this.playimg.spriteFrame = e;
            this.leveliconspr = this.node.getChildByName("levelicon").getComponent(cc.Sprite);
            t = ["小牌子", "小牌子-1", "小牌子-2", "小牌子-3", "xiaowu"];
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/" + t[this.playerInfo.equipLevel], cc.SpriteFrame)];
          case 2:
            o = n.sent();
            this.leveliconspr.spriteFrame = o;
            return [2];
        }
      });
    });
  };
  _creator.prototype.getAttackTag = function (e) {
    var t = null;
    if (!this.mosterNodes) {
      if ((i = GameGlobalVariable.GameGlobalVariable.mosterNode).children.length > 0) {
        return i.children[0];
      } else {
        return t;
      }
    }
    if (this.mosterNodes.children.length > 0) {
      var o = null;
      switch (e) {
        case 4:
          var n = this.mosterNodes.children;
          var i = null;
          for (var a = 0; a < n.length; a++) {
            var r = n[a].getComponent(UI_MosterLogic.default);
            if (1 == r.nowmosterdata.boss) {
              i = r;
              break;
            }
          }
          if (i) {
            t = i.node;
          } else {
            (o = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes)).length > 0 && (t = o[0].script.node);
          }
          break;
        case 10:
        case 1:
          (o = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes)).length > 0 && (t = o[0].script.node);
          break;
        case 2:
          (o = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes)).length > 0 && (t = o[CommonUtils.default.limitInteger(0, o.length - 1)].script.node);
          break;
        case 3:
          if ((o = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes)).length > 0) {
            var c = o[this.nowattackindex];
            if (!c) {
              this.nowattackindex = 0;
              c = o[this.nowattackindex];
            }
            t = c.script.node;
            this.nowattackindex += 1;
          }
          if (!t) {
            var s = null;
            for (a = 0; a < o.length && !(s = o[a]); a++) {
              ;
            }
            s && (t = s.script.node);
          }
          break;
        case 8:
        case 5:
          break;
        default:
          (o = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes)).length > 0 && (t = o[0].script.node);
      }
    }
    return t;
  };
  _creator.prototype.sendAttack = function () {
    var e = this;
    var t = this.getAttackTag(this.sgattacktagtype);
    if (t) {
      cc.tween(this.playimg.node).to(.1, {
        scaleY: 1.3,
        scaleX: 1.1
      }).to(.1, {
        scale: 1
      }).start();
      var o = BuffMag.BuffMgr.playerAttackFangshiIng(this, this.sgattacktype);
      var n = BuffMag.BuffMgr.playAttackJiaCheng(this, this.sgattack, 1);
      var i = BuffMag.BuffMgr.getAttackBaoJi(this);
      var a = this.sgbaojilv + i.baojijilv;
      var r = this.sgbaojia + i.baojijiacheng;
      var c = false;
      if (Math.random() <= a) {
        c = true;
        n *= r;
      }
      BuffMag.BuffMgr.getLianXuAttack(this) && this.scheduleOnce(function () {
        e.sendBullet(o, n, t, c);
      }, .1);
      this.sendBullet(o, n, t, c);
    }
  };
  _creator.prototype.sendAttackMove = function () {
    if (this.mosterNodes.children.length >= 1) {
      var e = BuffMag.BuffMgr.playAttackJiaCheng(this, this.sgattack, 1);
      this.createBulletMove(e);
    }
  };
  _creator.prototype.sendAttackBomb = function () {
    if (this.mosterNodes.children.length >= 1) {
      cc.tween(this.playimg.node).to(.1, {
        scaleY: 1.1
      }).to(.1, {
        scaleY: 1
      }).start();
      var e = BuffMag.BuffMgr.playAttackJiaCheng(this, this.sgattack, 1);
      var t = this.getBulletBombPos();
      t && this.createBulletBomb(e, t);
    }
  };
  _creator.prototype.sendBullet = function (e, t, o, n) {
    switch (e) {
      case 1:
        this.createBullet(t, o, 1, n);
        break;
      case 2:
        var i = GameGlobalVariable.GameGlobalVariable.paixuMoster(this.mosterNodes);
        for (var a = 0; a < 3; a++) {
          var r = i[a];
          r && this.createBullet(t, r.script.node, a + 1, n);
        }
    }
  };
  _creator.prototype.getBulletBombPos = function () {
    cc.v2();
    var e = GameGlobalVariable.GameGlobalVariable.paths.children;
    var t = [];
    for (var o = 0; o < e.length - 1; o++) {
      var n = e[o];
      var i = e[o + 1];
      var a = 0;
      0 == o && (a = -100);
      var r = 0;
      o + 1 == 5 && (r = 100);
      var c = CommonUtils.default.getRandomInt(n.x + a, i.x + r);
      var s = CommonUtils.default.getRandomInt(n.y, i.y);
      t.push({
        x: c,
        y: s
      });
    }
    return t[CommonUtils.default.getRandomInt(0, t.length - 1)];
  };
  _creator.prototype.createBulletMove = function (e) {
    return __awaiter(this, undefined, undefined, function () {
      var t;
      var o;
      var n;
      var i;
      var a;
      return __generator(this, function () {
        t = BuffMag.BuffMgr.getAttackBaoJi(this);
        o = this.sgbaojilv + t.baojijilv;
        n = this.sgbaojia + t.baojijiacheng;
        i = false;
        if (Math.random() <= o) {
          i = true;
          e *= n;
        }
        cc.tween(this.playimg.node).to(.1, {
          scaleY: 1.1
        }).to(.1, {
          scaleY: 1
        }).start();
        a = BuffMag.BuffMgr.getLajiaoBiSha(this);
        GameGlobalVariable.GameGlobalVariable.addMoveBullet({
          attack: e,
          playerId: this,
          playerLevel: this.playerInfo.equipLevel,
          isbaoji: i,
          isbisha: a
        });
        return [2];
      });
    });
  };
  _creator.prototype.createBulletBomb = function (e, t) {
    return __awaiter(this, undefined, undefined, function () {
      var o;
      var n;
      var i;
      var a = this;
      return __generator(this, function (r) {
        switch (r.label) {
          case 0:
            if (o = NodePoolMag.NodePoolMag.instance.getNode("bullet_2")) {
              return [3, 2];
            } else {
              return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "prefabs/bullet/bullet2", cc.Prefab)];
            }
          case 1:
            n = r.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount("bullet_2", 1, n);
            o = NodePoolMag.NodePoolMag.instance.getNode("bullet_2");
            r.label = 2;
          case 2:
            i = this.auto_ui.node_sendpoint.convertToWorldSpaceAR(cc.v2());
            i = GameGlobalVariable.GameGlobalVariable.languaNode.convertToNodeSpaceAR(i);
            o.x = i.x;
            o.y = i.y;
            GameGlobalVariable.GameGlobalVariable.languaNode.addChild(o);
            this.scheduleOnce(function () {
              var n = o.getComponent(UI_BulletBomb.default);
              var i = BuffMag.BuffMgr.getAttackBaoJi(a);
              var r = a.sgbaojilv + i.baojijilv;
              var c = a.sgbaojia + i.baojijiacheng;
              var s = false;
              if (Math.random() <= r) {
                s = true;
                e *= c;
              }
              var u = BuffMag.BuffMgr.getLajiaoBiSha(a);
              n.initBullet({
                attack: e,
                playerId: a,
                skinlevel: a.playerInfo.equipLevel,
                isbaoji: s,
                isbisha: u
              }, t);
            });
            return [2];
        }
      });
    });
  };
  _creator.prototype.createBullet = function (e, t, o, n) {
    return __awaiter(this, undefined, undefined, function () {
      var i;
      var a;
      var r;
      var c;
      var l = this;
      return __generator(this, function (s) {
        switch (s.label) {
          case 0:
            if (i = NodePoolMag.NodePoolMag.instance.getNode("bullet_1")) {
              return [3, 2];
            } else {
              return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "prefabs/bullet/bullet1", cc.Prefab)];
            }
          case 1:
            a = s.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount("bullet_1", 5, a);
            i = NodePoolMag.NodePoolMag.instance.getNode("bullet_1");
            s.label = 2;
          case 2:
            r = this.auto_ui.node_sendpoint.convertToWorldSpaceAR(cc.v2());
            r = GameGlobalVariable.GameGlobalVariable.bulletNode.convertToNodeSpaceAR(r);
            i.x = r.x;
            i.y = r.y;
            GameGlobalVariable.GameGlobalVariable.bulletNode.addChild(i);
            c = BuffMag.BuffMgr.getLajiaoBiSha(this);
            this.scheduleOnce(function () {
              i.getComponent(UI_Bullet.default).initBullet({
                attack: e,
                playerId: l,
                feixintype: o,
                isbaoji: n,
                isbisha: c
              }, t);
            });
            return [2];
        }
      });
    });
  };
  _creator.prototype.setKuangRe = function (e) {
    if (!this.kuangrePlayer || this.kuangrePlayer.node.uuid != e.node.uuid && this.kuangrePlayer.playerInfo.equipLevel < e.playerInfo.equipLevel) {
      this.kuangrePlayer = e;
      var t = Excel.Excel.shuiguobuff(e.sgtianfuid);
      this.kuangretime = t.bufftime;
      LogManager.LogMgr.debug("设置狂热效果", this);
      this.cleanKuangReEff();
      this.addKuangReEff();
    }
  };
  _creator.prototype.addKuangReEff = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      return __generator(this, function (t) {
        switch (t.label) {
          case 0:
            this.xiaolajiao && this.showXiaoLaJiao();
            this.kuangReEffNode = NodePoolMag.NodePoolMag.instance.getNode("kuangre");
            if (this.kuangReEffNode) {
              return [3, 2];
            } else {
              return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "prefabs/effpre/UI_KuangRe", cc.Prefab)];
            }
          case 1:
            e = t.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount("kuangre", 1, e);
            this.kuangReEffNode = NodePoolMag.NodePoolMag.instance.getNode("kuangre");
            t.label = 2;
          case 2:
            this.kuangReEffNode.x = 0;
            this.kuangReEffNode.y = 0;
            this.kuangReParNode.addChild(this.kuangReEffNode);
            return [2];
        }
      });
    });
  };
  _creator.prototype.showXiaoLaJiao = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      var t;
      var o;
      return __generator(this, function (n) {
        switch (n.label) {
          case 0:
            e = this.xiaolajiao.getComponent(cc.Sprite);
            t = "xialajiao";
            4 == this.kuangrePlayer.playerInfo.equipLevel && (t = "xialajiao1");
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/" + t, cc.SpriteFrame)];
          case 1:
            o = n.sent();
            e.spriteFrame = o;
            this.xiaolajiao.active = true;
            return [2];
        }
      });
    });
  };
  _creator.prototype.cleanKuangReEff = function () {
    if (this.kuangReEffNode) {
      this.xiaolajiao && (this.xiaolajiao.active = false);
      NodePoolMag.NodePoolMag.instance.recycleNode("kuangre", this.kuangReEffNode);
      this.kuangReEffNode = null;
      this.kuangretime = 0;
      this.offkuangretime = 0;
    }
  };
  _creator.prototype.puasePlayer = function () { };
  _creator.prototype.onUpdate = function (e) {
    if (this.kuangrePlayer && !this.kuangreisOver) {
      this.offkuangretime += e;
      if (this.offkuangretime >= 1) {
        this.kuangretime -= 1;
        this.offkuangretime = 0;
        if (this.kuangretime <= 0) {
          if (BuffMag.BuffMgr.getKuangReOver()) {
            this.kuangreisOver = true;
          } else {
            this.cleanKuangReEff();
            this.kuangrePlayer = null;
            this.kuangretime = 0;
          }
        }
      }
    }
    if (!this.playerpuase) {
      this.attacktime += e;
      var t = BuffMag.BuffMgr.playAttackJiaCheng(this, this.sgattackspeed, 2);
      t < .15 && (t = 5 == this.playerId ? .25 : .15);
      t /= GameGlobalVariable.GameGlobalVariable.jiasuState;
      if (this.attacktime >= t) {
        this.startAttack();
        this.attacktime = 0;
      }
    }
  };
  _creator.prototype.sendAttackGun = function () {
    return __awaiter(this, undefined, undefined, function () {
      var e;
      var t;
      var o;
      var n;
      var i;
      var a;
      return __generator(this, function () {
        if (e = this.getAttackTag(this.sgattacktagtype)) {
          cc.tween(this.playimg.node).to(.1, {
            scaleY: 1.3,
            scaleX: 1.1
          }).to(.1, {
            scale: 1
          }).start();
          t = BuffMag.BuffMgr.playAttackJiaCheng(this, this.sgattack, 1);
          o = BuffMag.BuffMgr.getAttackBaoJi(this);
          n = this.sgbaojilv + o.baojijilv;
          i = this.sgbaojia + o.baojijiacheng;
          a = false;
          if (Math.random() <= n) {
            a = true;
            t *= i;
          }
          this.createAttackGun(t, e, 1, a);
          return [2];
        } else {
          return [2];
        }
      });
    });
  };
  _creator.prototype.createAttackGun = function (e, t, o, n) {
    return __awaiter(this, undefined, undefined, function () {
      var i;
      var a;
      var r;
      var c = this;
      return __generator(this, function (s) {
        switch (s.label) {
          case 0:
            if (i = NodePoolMag.NodePoolMag.instance.getNode("bullet_4")) {
              return [3, 2];
            } else {
              return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "prefabs/bullet/bullet4", cc.Prefab)];
            }
          case 1:
            a = s.sent();
            NodePoolMag.NodePoolMag.instance.createNodeCount("bullet_4", 5, a);
            i = NodePoolMag.NodePoolMag.instance.getNode("bullet_4");
            s.label = 2;
          case 2:
            r = this.auto_ui.node_sendpoint.convertToWorldSpaceAR(cc.v2());
            r = GameGlobalVariable.GameGlobalVariable.playereffNode.convertToNodeSpaceAR(r);
            i.x = r.x;
            i.y = r.y;
            GameGlobalVariable.GameGlobalVariable.playereffNode.addChild(i);
            this.scheduleOnce(function () {
              i.getComponent(UI_BulletBang.default).initBullet({
                attack: e,
                playerId: c,
                feixintype: o,
                isbaoji: n
              }, t);
            });
            return [2];
        }
      });
    });
  };
  _creator.prototype.startAttack = function () {
    BuffMag.BuffMgr.addPlayerSendCount(this);
    switch (this.sgattacktagtype) {
      case 7:
        this.sendAttackMove();
        break;
      case 6:
        this.sendAttackBomb();
        break;
      case 9:
        cc.tween(this.playimg.node).to(.1, {
          scaleY: 1.1
        }).to(.1, {
          scaleY: 1
        }).start();
        BuffMag.BuffMgr.setKuangReBuff(this);
        break;
      case 10:
        this.sendAttackGun();
        break;
      default:
        this.sendAttack();
    }
  };
  __decorate([_property(UI_Player_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  __decorate([_property()], _creator.prototype, "playerId", undefined);
  __decorate([_property(cc.Sprite)], _creator.prototype, "playimg", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "eff1", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "eff2", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "bangbangNode", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_Player;